home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12404 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: prodigy.com!usenet
  2. From: DPMU12A@prodigy.com (Steve Bailey)
  3. Newsgroups: comp.lang.c
  4. Subject: File Open Problem - Please provide clues
  5. Date: 31 Mar 1996 02:22:09 GMT
  6. Organization: Prodigy Services Company  1-800-PRODIGY
  7. Distribution: world
  8. Message-ID: <4jkq8h$1it6@useneta1.news.prodigy.com>
  9. NNTP-Posting-Host: innugap1-int.news.prodigy.com
  10. X-Newsreader: Version 1.2
  11.  
  12.  
  13. Hi I'm having problems with opening files which are named   
  14. after simple numbers:                                       
  15. 2                                                           
  16. 5, etc.                                                     
  17. The reason for naming them this way is because I'm writing a
  18. program in C that increments a number, and then attempts to 
  19. open the file that's actually named by that number.         
  20. I get mismatched type errors when using FOPEN:              
  21.  int num;                                                   
  22.  filepointer = FOPEN(num,"r");            or                           
  23.  filepointer = FOPEN("num","r");
  24.  
  25. Is there a way to manipulate an integer: store it in integer
  26. variables, arrays, etc.., but then use that integer to open 
  27. a file actually named by that integer?..                    
  28.  I was going to name the files:                             
  29.   0.txt, 1.txt, 2.txt,                                      
  30.  and so forth, but this was even trickier with the string   
  31. concatenating, (attached ".txt" to it) etc.. so the files   
  32. are named after numbers simply..                            
  33.                                                             
  34. any help appreciated.                                       
  35. Steve
  36.  
  37.  
  38.